<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="../js/vue.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<body>
		<div id="root">
			姓：<input type="text" v-model="x"><br>
			名：<input type="text" v-model="m"><br>
			姓名：<span>{{fullName}}</span>
		</div>
		<script type="text/javascript">
			const vm=new Vue({
				el:'#root',
				data:{
					x:'张',
					m:'三'
				},
				computed:{
					fullName:{
						get(){
							return this.x+'-'+this.m
						},
						set(value){
							const arr=value.split('-')
							this.x=arr[0]
							this.m=arr[1]
						}
					}
				}
			})
		</script>
	</body>
</html>
